<?php
//  ___  ____       _  ______ _ _        _   _           _
//  |  \/  (_)     (_) |  ___(_) |      | | | |         | |
//  | .  . |_ _ __  _  | |_   _| | ___  | |_| | ___  ___| |_
//  | |\/| | | '_ \| | |  _| | | |/ _ \ |  _  |/ _ \/ __| __|
//  | |  | | | | | | | | |   | | |  __/ | | | | (_) \__ \ |_
//  \_|  |_/_|_| |_|_| \_|   |_|_|\___| \_| |_/\___/|___/\__|
//
// by GalaxyScripts.com                version 1.2
// original source code by Jim (j-fx.ws)
////////////////////////////////////////////////////////
if(isset($_GET['language'])) {
echo "<center>You do not have permission to do that!</center>";
die;
}
include("./lang/$language.php");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META NAME="revisit-after" CONTENT="2 days">
<link rel="SHORTCUT ICON" href="favicon.ico">
<script type="text/javascript">

function CancelUpload() {
    if (confirm("Are you sure you wish to cancel the upload?")) {
      window.location = "index.php";
    }
}
</script>
<SCRIPT language="JavaScript">
var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read and accept terms to submit form")
return false
}
}
}
</script>
<script type="text/javascript"><!--
function agreeTerms()
{
document.getElementById("upload").disabled=false
document.getElementById("checkBox").checked=true
}
function denyTerms()
{
document.getElementById("upload").disabled=true
document.getElementById("checkBox").checked=false
}

var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}

//--></script>

<!-- flooble Expandable Content header start -->
<script language="javascript">
// Expandable content script from flooble.com.
// For more information please visit:
//   http://www.flooble.com/scripts/expand.php
// Copyright 2002 Animus Pactum Consulting Inc.
//----------------------------------------------
var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } }
function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId);
 if (lText == '+') { link.innerHTML = '-'; d.style.display = 'block'; }
 else { link.innerHTML = '+'; d.style.display = 'none'; } }
</script>
<!-- flooble Expandable Content header end   -->

<!-- SWFUpload START -->

	<link href="progress/default.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="progress/swfupload.js"></script>
	<script type="text/javascript" src="progress/swfupload.graceful_degradation.js"></script>
	<script type="text/javascript" src="progress/handlers.js"></script>
	<script type="text/javascript">
		var swf_upload_control;

        window.onload = function () {
            denyTerms();
            swf_upload_control = new SWFUpload({
				// Backend settings
				upload_url: "../upload.php?do=verify",	// Relative to the SWF file, you can use an absolute URL as well.
				file_post_name: "upfile",

				// Flash file settings
				file_size_limit : "<? echo ($maxfilesize * 1024); ?>",	// <? echo $maxfilesize; ?> MB
				file_types : "*.*",	// or you could use something like: "*.doc;*.wpd;*.pdf",
				file_types_description : "All Files",
				file_upload_limit : "0", // Even though I only want one file I want the user to be able to try again if an upload fails
				file_queue_limit : "1", // this isn't needed because the upload_limit will automatically place a queue limit

				// Event handler settings
				swfupload_loaded_handler : myShowUI,

				//file_dialog_start_handler : fileDialogStart,		// I don't need to override this handler
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,

				//upload_start_handler : uploadStart,	// I could do some client/JavaScript validation here, but I don't need to.
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,

				// Flash Settings
				flash_url : "progress/swfupload_f9.swf",	// Relative to this file

				// UI settings
				swfupload_element_id : "flashUI",		// setting for the graceful degradation plugin
				degraded_element_id : "degradedUI",

				custom_settings : {
					progress_target : "fsUploadProgress",
					upload_successful : false
				},

				// Debug settings
				debug: false
			});

        }

        function myShowUI() {
            var btnSubmit = document.getElementById("upload");

			btnSubmit.onclick = doSubmit;

            SWFUpload.swfUploadLoaded.apply(this);  // Let SWFUpload finish loading the UI.
        }

		function fileBrowse() {
			var txtFileName = document.getElementById("txtFileName");
			txtFileName.value = "";

			this.cancelUpload();
			this.selectFile();
		}


        // Called by the submit button to start the upload
		function doSubmit(e) {
			e = e || window.event;
			if (e.stopPropagation) e.stopPropagation();
			e.cancelBubble = true;

			try {
				swf_upload_control.setPostParams({ "myemail": document.getElementById('myemail') != null ? document.getElementById('myemail').value : "", "descr": document.getElementById('descr') != null ? document.getElementById('descr').value : "", "pprotect" : document.getElementById('pprotect') != null ? document.getElementById('pprotect').value : "" }); 	// Here are some POST values to send. These can be changed dynamically
				swf_upload_control.startUpload();
				document.getElementById("cancel").style.display="inline";
			} catch (ex) {
            	alert('1');
            }
            return false;
	    }

		 // Called by the queue complete handler to submit the form
	    function uploadDone() {
			try {
				document.forms[0].submit();
			} catch (ex) {
				alert("Error submitting form");
			}
	    }
	</script>


<!-- SWFUpload END -->

</head>
<body>
<tr><td colspan=2 style="border:1px #AAAAAA solid;height:100%;background-color:#FFFFFF;padding:20px;text-align:left;" valign=top>
  	<? include("./ads.php"); ?>
<p><center><? echo $lang[info];?></center></p>

<h1><center><? echo $lang[upload];?></center></h1>
	<br />
	<center>
	<form enctype="multipart/form-data" action="upload.php?do=verify" id="form" method="post" onsubmit="a=document.getElementById('form').style;a.display='none';b=document.getElementById('part2').style;b.display='inline';" style="display: inline;">
	<? echo $lang[maxsize];?> <b><?php echo $maxfilesize; ?> MB</b><br />
         <table border=0 cellspacing=0 cellpadding=2><tr><td align=center colspan=2>
	<?php echo $filetypes; ?>

<!-- SWFUpload START -->

							<div id="flashUI" style="display: none;">
								<!-- The UI only gets displayed if SWFUpload loads properly -->
								<div>
										<img src="img/bild.gif"> <input type="text" id="txtFileName" disabled="true" size="50" /><input id="btnBrowse" type="button" value="Browse..." onclick="fileBrowse.apply(swf_upload_control)" />
								</div>
								<div class="flash" id="fsUploadProgress">
									<!-- This is where the file progress gets shown.  SWFUpload doesn't update the UI directly.
										The Handlers (in handlers.js) process the upload events and make the UI updates -->
								</div>
								<input type="hidden" name="hidFileID" id="hidFileID" value="" /><!-- This is where the file ID is stored after SWFUpload uploads the file and gets the ID back from upload.php -->
							</div>
							<div id="degradedUI">
								<!-- This is the standard UI.  This UI is shown by default but when SWFUpload loads it will be
								hidden and the "flashUI" will be shown -->
									<img src="img/bild.gif"> <input type="file" name="upfile" id="resume_degraded" size="50" /><br/>
							</div>

<!-- SWFUpload END -->
</td></tr>
    <tr><td align=left><?php if($emailoption) { ?><? echo $lang[emailopt];?>:</td><td align=right><input type="text" id="myemail" name="myemail" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
	<tr><td align=left><?php if($descriptionoption) { ?><? echo $lang[desopt];?>:</td><td align=right><input type="text" id="descr" name="descr" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
	<tr><td align=left><?php if($passwordoption) { ?><? echo $lang[passopt];?>:</td><td align=right><input type="text" id="pprotect" name="pprotect" size="40" /> <i>(<? echo $lang[opt];?>)</i></td></tr><?php } ?>
         <tr><td align=center colspan=2><?php if(isset($categorylist)) { echo $c; } ?></td></tr></table>
	<input id="checkBox" type="checkBox" onclick="if (this.checked) {agreeTerms()} else {denyTerms()}"> <? echo $lang[sinfo];?> <a href="?page=tos"><? echo $lang[tos];?></a>. <p><center><input type="submit" value="Upload" id="upload" /> <input type="button" id="cancel" value="Cancel" onclick="CancelUpload()" style="display: none"></center>
</form>

<br /><? echo $lang[hosting];?>  <b><?php echo $total; ?></b> <? echo $lang[files];?> <b><?php echo $sizehosted; ?></b> MB <? echo $lang[total];?>
<p>	<? include("./bottomads.php"); ?>
</center></td></tr></table><p style="margin:3px;text-align:center">
